﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;

namespace MusicPlayer
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {

        protected override void OnStartup(StartupEventArgs e)
        {
           
            #region Attach General exception Handlers
            Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(dispatcherHandler);
            #endregion // Attach General exception handlers

            base.OnStartup(e);
        }

        void dispatcherHandler(object sender, DispatcherUnhandledExceptionEventArgs args)
        {
            
            Exception e = (Exception)args.Exception;

            MessageBox.Show("Music Player general error occured\n" + e.Message);
            
            args.Handled = true;
        }

    }
}
